{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b7689a24",
   "metadata": {},
   "source": [
    "# Generation Scotland: Scottish Family Health Study (GS:SFHS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "614d3acd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-07-28T18:55:48.579060Z",
     "iopub.status.busy": "2025-07-28T18:55:48.579060Z",
     "iopub.status.idle": "2025-07-28T18:55:53.347279Z",
     "shell.execute_reply": "2025-07-28T18:55:53.346259Z"
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       ">Last modified: 28 Jul 2025"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "import sys\n",
    "import os\n",
    "sys.path.append(os.path.abspath('../../scripts/'))\n",
    "from data_doc_helper import LPSSource as SS, last_modified\n",
    "ss = SS(\"GENSCOT\")\n",
    "last_modified()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "378f0be3",
   "metadata": {},
   "source": [
    "## 1. Summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6ddc075f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-07-28T18:55:53.357277Z",
     "iopub.status.busy": "2025-07-28T18:55:53.357277Z",
     "iopub.status.idle": "2025-07-28T18:55:53.370863Z",
     "shell.execute_reply": "2025-07-28T18:55:53.368657Z"
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Generation Scotland (GENSCOT) collects data about participants and their families to improve understanding, prevention and treatment of conditions for current and future generations. "
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ss.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "588af130",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-07-28T18:55:53.378060Z",
     "iopub.status.busy": "2025-07-28T18:55:53.377066Z",
     "iopub.status.idle": "2025-07-28T18:55:54.889431Z",
     "shell.execute_reply": "2025-07-28T18:55:54.886678Z"
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_92a8b th {\n",
       "  text-align: left;\n",
       "}\n",
       "#T_92a8b_row0_col0, #T_92a8b_row0_col1, #T_92a8b_row1_col0, #T_92a8b_row1_col1, #T_92a8b_row2_col0, #T_92a8b_row2_col1, #T_92a8b_row3_col0, #T_92a8b_row3_col1, #T_92a8b_row4_col0, #T_92a8b_row4_col1, #T_92a8b_row5_col0, #T_92a8b_row5_col1, #T_92a8b_row6_col0, #T_92a8b_row6_col1, #T_92a8b_row7_col0, #T_92a8b_row7_col1, #T_92a8b_row8_col0, #T_92a8b_row8_col1, #T_92a8b_row9_col0, #T_92a8b_row9_col1, #T_92a8b_row10_col0, #T_92a8b_row10_col1, #T_92a8b_row11_col0, #T_92a8b_row11_col1, #T_92a8b_row12_col0, #T_92a8b_row12_col1 {\n",
       "  text-align: left;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_92a8b\" style=\"font-size: 14px\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_92a8b_level0_col0\" class=\"col_heading level0 col0\" >Series Descriptor</th>\n",
       "      <th id=\"T_92a8b_level0_col1\" class=\"col_heading level0 col1\" >Series-specific Information</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row0_col0\" class=\"data row0 col0\" >Citation (APA)</td>\n",
       "      <td id=\"T_92a8b_row0_col1\" class=\"data row0 col1\" >Centre for Medical Informatics, Usher Institute, University of Edinburgh. (2021). <i>Generation Scotland (GENSCOT).</i> UK Longitudinal Linkage Collaboration (UK LLC).  <a href=\"https://doi.org/10.71760/ukllc-series-00009\" rel=\"noopener noreferrer\" target=\"_blank\">https://doi.org/10.71760/ukllc-series-00009</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row1_col0\" class=\"data row1 col0\" >Download Citation</td>\n",
       "      <td id=\"T_92a8b_row1_col1\" class=\"data row1 col1\" > <a href=\"https://api.datacite.org/application/vnd.citationstyles.csl+json/10.71760/ukllc-series-00009\" rel=\"noopener noreferrer\" target=\"_blank\">Citeproc JSON</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href=\"https://api.datacite.org/application/x-bibtex/10.71760/ukllc-series-00009\" rel=\"noopener noreferrer\" target=\"_blank\">BibTeX</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href=\"https://api.datacite.org/application/x-research-info-systems/10.71760/ukllc-series-00009\" rel=\"noopener noreferrer\" target=\"_blank\">RIS</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row2_col0\" class=\"data row2 col0\" >Owner</td>\n",
       "      <td id=\"T_92a8b_row2_col1\" class=\"data row2 col1\" >University of Edinburgh</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row3_col0\" class=\"data row3 col0\" >Cohort</td>\n",
       "      <td id=\"T_92a8b_row3_col1\" class=\"data row3 col1\" >23,960 individuals<br>\n",
       "5,573 families</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row4_col0\" class=\"data row4 col0\" >Age at Recruitment</td>\n",
       "      <td id=\"T_92a8b_row4_col1\" class=\"data row4 col1\" >18-100 years</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row5_col0\" class=\"data row5 col0\" >Geographical Coverage - Nations</td>\n",
       "      <td id=\"T_92a8b_row5_col1\" class=\"data row5 col1\" >Scotland</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row6_col0\" class=\"data row6 col0\" >Geographical Coverage - Regions</td>\n",
       "      <td id=\"T_92a8b_row6_col1\" class=\"data row6 col1\" >Nationwide</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row7_col0\" class=\"data row7 col0\" >Start Date</td>\n",
       "      <td id=\"T_92a8b_row7_col1\" class=\"data row7 col1\" >2006-10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row8_col0\" class=\"data row8 col0\" >Permitted Linkages</td>\n",
       "      <td id=\"T_92a8b_row8_col1\" class=\"data row8 col1\" >See  <a href=\"https://guidebook.ukllc.ac.uk/docs/lps/linkages/lps_linkages\" rel=\"noopener noreferrer\" target=\"_blank\">here</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row9_col0\" class=\"data row9 col0\" >Inclusion in Linkages</td>\n",
       "      <td id=\"T_92a8b_row9_col1\" class=\"data row9 col1\" >Consent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row10_col0\" class=\"data row10 col0\" >Cohort Profile</td>\n",
       "      <td id=\"T_92a8b_row10_col1\" class=\"data row10 col1\" > <a href=\"https://doi.org/10.1093/ije/dys084\" rel=\"noopener noreferrer\" target=\"_blank\">10.1093/ije/dys084</a></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row11_col0\" class=\"data row11 col0\" >LPS Homepage</td>\n",
       "      <td id=\"T_92a8b_row11_col1\" class=\"data row11 col1\" ><p><a href=\"https://www.ed.ac.uk/generation-scotland\">ed.ac.uk</a></p></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_92a8b_row12_col0\" class=\"data row12 col0\" >Build a Data Request</td>\n",
       "      <td id=\"T_92a8b_row12_col1\" class=\"data row12 col1\" > <a href=\"https://explore.ukllc.ac.uk/\" rel=\"noopener noreferrer\" target=\"_blank\">https://explore.ukllc.ac.uk/</a></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x230934e0fb0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ss.info_table()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9a610537",
   "metadata": {},
   "source": [
    "## 2. Linkage Rates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b577ddf1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-07-28T18:55:54.897513Z",
     "iopub.status.busy": "2025-07-28T18:55:54.896510Z",
     "iopub.status.idle": "2025-07-28T18:55:54.911047Z",
     "shell.execute_reply": "2025-07-28T18:55:54.908511Z"
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Linkage rates will be displayed for GENSCOT in due course."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ss.linkages_plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2dcdab37",
   "metadata": {},
   "source": [
    "## 3. Documentation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "4f4df265",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-07-28T18:55:54.921044Z",
     "iopub.status.busy": "2025-07-28T18:55:54.920043Z",
     "iopub.status.idle": "2025-07-28T18:55:54.932544Z",
     "shell.execute_reply": "2025-07-28T18:55:54.931040Z"
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "We are currently building a documentation storage system which will host useful documents related to datasets and data owners. We will surface these documents on Guidebook."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ss.documentation()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "jupbook",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}